
<link rel="stylesheet" type="text/css" href="themes/admin/style.css" />

<!--[if IE]><script type="text/javascript" src="/js/excanvas.pack.js"></script><![endif]-->
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.corner.pack.js"></script>
<script type="text/javascript" src="/js/jquery.pngFix.js"></script>
<script type="text/javascript" src="/themes/admin/tips.js"></script>
<script type="text/javascript">
function vid(p){return document.getElementById(p);}

$(document).ready(function () {
	$(".simple_table").corner("10px");
	$(".message").corner("10px");
	$(".error").corner("10px");
	$("#content").corner("tr br 10px");
	$("#help").corner("tr br 10px");
	$("#update_message").corner("10px");
	
	$("#loading-layer").ajaxStart(function(){ $(this).show(); });
	$("#loading-layer").ajaxStop(function(){ $(this).hide(); });
});


function rest_block () {
	
	$.get(
		"/ajax/admin_menu/",
		{ "rest" : 1 },
		function(ret) { $("#rest_block").html(ret); }
	);
	
	$("#rest_block").slideDown('slow');
}

function light_on (id) { id.style.backgroundImage = "url('/themes/admin/images/block_button.gif')"; }
function light_off (id) { id.style.backgroundImage = ""; }

function show_help () { $("#help_cont").slideDown('slow'); }

/* table */

function reload_buttons () {
	
	$.get(
		"/ajax/admin_buttons/",
		{ "reload" : 1 },
		function(ret) { $("#work_table").html(ret); }
	);
	close_editform ();
	return_table ();
}

function delete_item (id) {
	
	if (confirm('Вы действительно хотите удалить кнопку?')) {
	
		$.get(
			"/ajax/admin_buttons/",
			{ "delete" : id },
			function(ret) { $("#work_table").html(ret); }
		);
		return_table ();
	}
}

function edit_table () {
	$(".admin_block_eff").animate({'opacity': '0.5'}, 'fast');
	$(".editing").show();
	$("#editing_buttons").show();
	
	$("#ret_button").html("<a href='javascript:void(0)' onclick='return_table();' style='color:#66FF99;'>вернуть нормальный режим</a>");
}

function return_table () {
	$(".editing").hide();
	$("#editing_buttons").hide();
	$(".admin_block_eff").animate({'opacity': '1.0'}, 'fast');
	
	$("#ret_button").html("<a href='javascript:void(0)' onclick='edit_table();'>настроить</a>");
}

function show_editform (iid, iname, ilink, icat) {
	$("#iid").attr("value", iid);
	$("#iname").attr("value", iname);
	$("#ilink").attr("value", ilink);
	$("#igroup").attr("value", icat);
	
	$("#screen").show();
	$("#picuploadform").show();
}

function close_editform () {
	$("#iid").attr("value", "");
	$("#iname").attr("value", "");
	$("#ilink").attr("value", "");
	$("#igroup").attr("value", "");
	
	$("#screen").hide();
	$("#picuploadform").hide();
}

</script>

</head>

<body>
<div id="loading-layer"><img src="/themes/admin/images/ajax-loader.gif" /></div>
<div id="screen"></div>

<!-- START HEADER LOGO -->

<div>
	<div id="informer"><div>
<?

$arts = $db->fetch_array ($db->query ("SELECT COUNT(art_id) AS cnt FROM ".DB_PEREFIX."_articles"));
$users = $db->fetch_array ($db->query ("SELECT COUNT(user_id) AS cnt FROM ".DB_PEREFIX."_users"));
$com = $db->fetch_array ($db->query ("SELECT COUNT(com_id) as cnt FROM ".DB_PEREFIX."_comments"));

$total_online = $db->fetch_array ($db->query ("SELECT COUNT(*) AS cnt FROM ".DB_PEREFIX."_sessions"));
$get_users_online = $db->fetch_array ($db->query ("SELECT COUNT(*) AS cnt FROM ".DB_PEREFIX."_sessions WHERE ugroup = 'user'"));

$db_size = 0;
$query = $db->query ("SHOW TABLE STATUS FROM ".$dbname);
while ($row = $db->fetch_array ($query)) {
	$db_size += $row['Data_length'] + $row['Index_length'];
}
$db_size = $db_size / 1024;
$db_size = round ($db_size, 1)." Кб";

print "\t\t<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">".
	"\r\n			<tr>".
	"\r\n				<td width=\"33%\">статей: <strong>".$arts['cnt']."</strong></td>".
	"\r\n				<td width=\"33%\">on-line всего: <strong>".$total_online['cnt']."</strong></td>".
	"\r\n				<td rowspan=\"3\" style=\"border-left:#e9e9e9 1px solid;\" width=\"34%\" ><img src=\"/themes/admin/images/return.gif\" align=\"absmiddle\" /> <a href=\"/\">вернуться на сайт</a><br /><img src=\"/themes/admin/images/exit.gif\" align=\"absmiddle\" /> <a href=\"/logout.html\">закончить сеанс</a></td>".
	"\r\n			</tr>".
	"\r\n			<tr>".
	"\r\n				<td>комметрариев: <strong>".$com['cnt']."</strong></td>".
	"\r\n				<td>польз. on-line: <strong>".$get_users_online['cnt']."</strong></td>".
	"\r\n			</tr>".
	"\r\n			<tr>".
	"\r\n				<td>пользователей: <strong>".$users['cnt']."</strong></td>".
	"\r\n				<td>размер БД: <strong>".$db_size."</strong></td>".
	"\r\n			</tr>".
	"\r\n\t\t</table>";

?>

    </div></div>
    <a href="admin.php"><img src="themes/admin/images/logo.jpg" /></a>
</div>

<!-- END HEADER LOGO -->

<!-- START BODY TABLE -->
<div style="background:url(themes/admin/images/main_top.gif) repeat-x;height:41px; width:100%; clear:both;" /><img src="themes/admin/images/corner_t_l.gif" style="float:left;" /><img src="themes/admin/images/corner_t_r.gif" style="float:right;" /></div>

<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td background="themes/admin/images/main_left.gif" width="41"></td>

<td>